package com.xof.phonecall

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import com.xof.phonecall.base.BaseViewModel
import com.xof.phonecall.model.ToBase
import com.xof.phonecall.network.RepoLaunch

class ViewModelLaunch : BaseViewModel() {

    private val mLiveDataAppVersion = MutableLiveData<ToBase>()

    val LiveDataCetAppVersion = Transformations.switchMap(mLiveDataAppVersion) { query ->
        RepoLaunch.getAppVersion(this, query)
    }

    fun checkAppVersion(showLoading: Boolean = true) {
        val toBase = ToBase()
        toBase.showLoading = showLoading
        mLiveDataAppVersion.value = toBase
    }
}